package main;

import java.io.IOException;
import java.util.Iterator;

import MyLinkedList.MyLinkedList;

public class Prova {
	
	public static void main(String[] args) throws IOException {
		MyLinkedList<Integer> list = new MyLinkedList<Integer>();
		
		System.out.println("Printing the contents of empty list (isEmpty = " + list.isEmpty() + "):");
		for (Integer elem : list)
			System.out.print(elem + " ");
		
		System.out.println();
		
		int i, max = 10;		
		for (i=0; i<=max; ++i) list.add(i, i);
		System.out.println("The list should contain numbers between 0 and "+max);		
		System.out.println("Printing the contents of the list:");
		for (Integer elem : list)
			System.out.print(elem + " ");
		
		System.out.println("\n");
		
		System.out.println("Using Iterator:");
		Iterator<Integer> it = list.iterator();
		while (it.hasNext()) {
			int value = it.next();
			if (value == 5)
				it.remove();
			
			System.out.print(value + " ");
		}
		
		System.out.println();	
		System.out.println("Printing the contents of the list (after remove):");
		for (Integer elem : list)
			System.out.print(elem + " ");
		
		
	}

}
